package routers

import (
	"device-admin/internal/app/web/controller"
	"device-admin/internal/app/web/middleware"

	"github.com/gin-gonic/gin"
)

func Default(router *gin.Engine) {
	/*健康检查*/
	router.GET("/health", func(c *gin.Context) {
		c.JSON(200, "ok")
	})

	// 远程控制
	{
		group := router.Group("/monitor")
		monitor(group)
	}

	// 位置
	{
		group := router.Group("/location")
		location(group)
	}
	// 设备
	{
		group := router.Group("/device")
		device(group)
	}

	// 设备端接口
	{
		group := router.Group("/robot")
		robot(group)
	}

	// 终端升级
	{
		group := router.Group("/terminal")
		terminal(group)
	}

	// 地图
	{
		group := router.Group("/map")
		deviceMap(group)
	}

	// 素材
	{
		group := router.Group("/material")
		materialMap(group)
	}

	// 售卖
	{
		group := router.Group("/sale")
		sale(group)
	}

	// 无需验证
	{
		group := router.Group("/nonauth")
		nonauth(group)
	}
	/*热力图*/
	router.GET("/heatmap/list", controller.HeatMap{}.List)
	router.GET("/heatmap/map-list", controller.HeatMap{}.MapList)

	/*告警管理*/
	router.GET("/alarm/notify-users")                                            // 获取告警通知人
	router.GET("/alarm/types", controller.Alarm{}.GetAlarmType)                  // 告警类型
	router.GET("/alarm/alarm-setting", controller.Alarm{}.GetAlarmNotifySetting) // 获取告警设置

	/*命令*/
	cmdRouter := router.Group("/cmd")
	cmdRouter.Use(middleware.DeviceOnlineCheck())
	cmdRouter.POST("/wildmsg", controller.CMD{}.WildMsg)

	/*websocket连接处理*/
	router.GET("/websocket", controller.WS{}.WebSocket)

	/*统计*/
	router.GET("/report/homepage-report", controller.Report{}.HomePageReport)

	// 公开的
	{
		group := router.Group("/public")
		public(group)
	}

	// 堡垒机
	{
		group := router.Group("/teleport")
		teleport(group)
	}

	// 广告
	{
		group := router.Group("/advertising")
		advertising(group)
	}
	// 开发日志
	{
		group := router.Group("/devlog")
		devlog(group)
	}
	// 文件请求
	{
		group := router.Group("/be-file")
		BEFile(group)
	}
	// 日志
	{
		group := router.Group("/log")
		log(group)
	}
}
